<?php if(!$noview) { ?>
<div class="calendars index">
<h2><?php __('Calendars');?></h2>
<?php
if($ctype == 4) {
	echo $this->element('playoff', array('calendars'=>$calendars, 'days'=>$numDays, 'nbTeams'=>$nbTeams));
} else {

for ( $day = $numDays; $day > 0; $day-- ) {
?>
	<h3><?php echo 'Day #'.$day?></h3>
	<?php
	for ( $group = $numGroups; $group > 0 ; $group-- ) {
	?>
<h4><?php echo 'Group #'.$group?></h3>

<table cellpadding="0" cellspacing="0">
<tr>
	<th><?php __('Home');?></th>
	<th><?php __('Score');?></th>
	<th><?php __('Away');?></th>
	<th><?php __('Spectators');?></th>
	<th><?php __('Rating');?></th>
	<th><?php __('Played');?></th>
	<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($calendars[$day][$group] as $calendar):
	$class = null;
	if ($i++ % 2 == 0) {
		$class = ' class="altrow"';
	}
?>
	<tr<?php echo $class;?>>
		<td><?php echo $html->link($calendar['TeamHome']['strName'], array('controller' => 'teams', 'action' => 'view', $calendar['TeamHome']['ID'])); ?></td>
		<td><?php echo $calendar['Calendar']['Home_iScore'].' - '.$calendar['Calendar']['Away_iScore']; ?></td>
		<td><?php echo $html->link($calendar['TeamAway']['strName'], array('controller' => 'teams', 'action' => 'view', $calendar['TeamAway']['ID'])); ?></td>
		<td><?php echo $calendar['Calendar']['iSpectators']; ?></td>
		<td><?php echo $calendar['Calendar']['iRating']; ?></td>
		<td><?php echo $calendar['Calendar']['bPlayed']; ?></td>
		<td class="actions">
			<?php echo $html->link(__('View', true), array('action' => 'view', $calendar['Calendar']['ID'])); ?>
			<?php echo $html->link(__('Edit', true), array('action' => 'edit', $calendar['Calendar']['ID'])); ?>
			<?php echo $html->link(__('Delete', true), array('action' => 'delete', $calendar['Calendar']['ID']), null, sprintf(__('Are you sure you want to delete # %s?', true), $calendar['Calendar']['ID'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
</table>
<?php }}} ?>
</div>
<?php } ?>